#include "../include/thread_warper.h"
#include    <boost/assert.hpp>
thread_warper::thread_warper(thread_func func)
:m_func(func),
m_thread_impl(NULL),
m_running(false)
{
    //ctor
}

thread_warper::~thread_warper()
{
    join();
}

void    thread_warper::start()
{
    BOOST_ASSERT(m_thread_impl == NULL);
    m_thread_impl = new boost::thread(m_func);
    m_running=true;
}

void    thread_warper::join()
{
    if(m_thread_impl){
        m_thread_impl->join();
        delete m_thread_impl;
    }
    m_thread_impl=NULL;
    m_running=false;
}

bool    thread_warper::is_running()
{
    return m_running;
}
